package com.macro.mall.model;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * ti_training_sign_record实体类
 */
@Data
@ApiModel(description = "签到签退报文",value = "签到签退报文")
public class TiTrainingSignRecord implements Serializable {
    /***/
    @ApiModelProperty(value = "")
    private Integer id;
    /**专题id*/
    @ApiModelProperty(value = "专题id")
    private Integer trainingId;
    /**签到开始时间*/
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @ApiModelProperty(value = "签到开始时间")
    private Date signInStartTime;
    /**签到结束时间*/
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @ApiModelProperty(value = "签到结束时间")
    private Date signInEndTime;
    /**签退开始时间*/
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @ApiModelProperty(value = "签退开始时间")
    private Date signOutStartTime;
    /**签退结束时间*/
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @ApiModelProperty(value = "签退结束时间")
    private Date signOutEndTime;
    /**签到状态*/
    @ApiModelProperty(value = "签到状态  00-可以签到  01-不可以签到")
    private String signInStatus;
    /**签退状态*/
    @ApiModelProperty(value = "签退状态  00-可以签退  01-不可以签退")
    private String signOutStatus;
    /**是否签到 0-否 1-是*/
    @ApiModelProperty(value = "是否签到 0-否 1-是")
    private Integer checked;

    /***/
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @ApiModelProperty(value = "")
    private Date createTime;
    /***/
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @ApiModelProperty(value = "")
    private Date updateTime;
    /**
     * 实例化
     */
    public TiTrainingSignRecord() {
        super();
    }
    /**
     * 实例化
     *
     * @param obj
     */

    public TiTrainingSignRecord(JSONObject obj) {
        this();
        if (obj.get("id") instanceof Number) {
            this.setId(((Number) obj.get("id")).intValue());
        }
        if (obj.get("trainingId") instanceof Number) {
            this.setTrainingId(((Number) obj.get("trainingId")).intValue());
        }
        this.setSignInStartTime((Date) obj.get("signInStartTime"));
        this.setSignInEndTime((Date) obj.get("signInEndTime"));
        this.setSignOutStartTime((Date) obj.get("signOutStartTime"));
        this.setSignOutEndTime((Date) obj.get("signOutEndTime"));
        if (obj.get("signInStatus") instanceof String) {
            this.setSignInStatus(((String) obj.get("signInStatus")));
        }
        if (obj.get("signOutStatus") instanceof String) {
            this.setSignOutStatus(((String) obj.get("signOutStatus")));
        }
        this.setCreateTime((Date) obj.get("createTime"));
    }

    /**
     * 将当前对象转换为JsonObject
     *
     * @return
     */
    public JSONObject toJson() {
        JSONObject result = new JSONObject();
        if (this.getId() != null) {
            result.put("id",this.getId());
        }
        if (this.getTrainingId() != null) {
            result.put("trainingId",this.getTrainingId());
        }
        if (this.getSignInStartTime() != null) {
            result.put("signInStartTime",this.getSignInStartTime());
        }
        if (this.getSignInEndTime() != null) {
            result.put("signInEndTime",this.getSignInEndTime());
        }
        if (this.getSignOutStartTime() != null) {
            result.put("signOutStartTime",this.getSignOutStartTime());
        }
        if (this.getSignOutEndTime() != null) {
            result.put("signOutEndTime",this.getSignOutEndTime());
        }
        if (this.getSignInStatus() != null) {
            result.put("signInStatus",this.getSignInStatus());
        }
        if (this.getSignOutStatus() != null) {
            result.put("signOutStatus",this.getSignOutStatus());
        }
        if (this.getCreateTime() != null) {
            result.put("createTime",this.getCreateTime());
        }
        return result;
    }

    @Override
    public String toString() {
        return "TiTrainingSignRecord [id=" + id + " , trainingId=" + trainingId + " , signInStartTime=" + signInStartTime + " , signInEndTime="
                + signInEndTime + " , signOutStartTime=" + signOutStartTime  + " , signOutEndTime=" + signOutEndTime + " , createTime=" + createTime + "  ]";

    }
}
